package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.Ymt_ExpressCountryToMode;
import com.ymttest.utils.EnvSetup;

/************************************************************************************
 * @File name : Ymt_ExpressCountryToModeWapper.java
 * @Author : zhouyi
 * @Date : 2015年4月2日
 * @Copyright : 洋码头
 ************************************************************************************/
public class Ymt_ExpressCountryToModeWapper {
	SqlManager manage;

	public Ymt_ExpressCountryToModeWapper() {
		manage = new SqlManager("ymt" + EnvSetup.getEnv());
	}

	public List<Map> selectbyCountryId(int countryId)
			throws InterruptedException {
		@SuppressWarnings("unchecked")
		List<Map> map = manage
				.getSelectResults(
						"com.ymttest.database.mapping.Ymt_ExpressCountryToModeMapper.selectbyCountryId",
						countryId);
		manage.commit();
		return map;
	}
	
	public int insert(Ymt_ExpressCountryToMode record)
			throws InterruptedException {
		int result= manage
				.insert(
						"com.ymttest.database.mapping.Ymt_ExpressCountryToModeMapper.insert",
						record);
		manage.commit();
		return result;
	}
    public int updateBycountryAndStatus(int countryId,int catalogStatus,boolean isDelete)
    {
    	HashMap<String,Object> map=new HashMap<String,Object>();
    	map.put("countryId", countryId);
    	map.put("catalogStatus", catalogStatus);
    	map.put("isDelete", isDelete);
    	int result= manage
				.update(
						"com.ymttest.database.mapping.Ymt_ExpressCountryToModeMapper.updateBycountryAndStatus",
						map);
		manage.commit();
		return result;
    }
	public static void main(String args[]) {
		new Ymt_ExpressCountryToModeWapper().updateBycountryAndStatus(0,1, false);
		new Ymt_ExpressCountryToModeWapper().updateBycountryAndStatus(0,2, false);
	}
}
